#include <rclcpp/rclcpp.hpp>

class NodeLog : public rclcpp::Node {
public:
  NodeLog(std::string name) : Node(name) {
    RCLCPP_INFO(this->get_logger(), "This is info log...");
    RCLCPP_INFO(this->get_logger(), "This is %02X\n", 5);
  }

  void timer_out() {
    while (1) {
      RCLCPP_INFO(this->get_logger(), "loop once 500ms...");
      rclcpp::sleep_for(std::chrono::milliseconds(500));
      RCLCPP_INFO_THROTTLE(this->get_logger(), *this->get_clock(), 2000,
                           "print info once during 1s...");
    }
  }
};

int main(int argc, char **argv) {
  rclcpp::init(argc, argv);
  auto node = std::make_shared<NodeLog>("test_log");
  node->timer_out();
  rclcpp::spin(node);
  rclcpp::shutdown();

  return 0;
}